package io.renren.modules.sp.service;

import io.renren.common.page.PageData;
import io.renren.common.service.CrudService;
import io.renren.common.utils.Result;
import io.renren.modules.sp.dto.SpMatchItemScoreImport;
import io.renren.modules.sp.dto.SpMatchItemTeamDTO;
import io.renren.modules.sp.dto.SpMatchItemTeamImport;
import io.renren.modules.sp.entity.SpMatchItemTeamEntity;
import io.renren.modules.sp.entity.SpTicketEntity;

import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.List;
import java.util.Map;

/**
 * 参赛队
 *
 * @author whc 15953295779@126.com
 * @since 3.0 2023-04-21
 */
public interface SpMatchItemTeamService extends CrudService<SpMatchItemTeamEntity, SpMatchItemTeamDTO> {

    Result saveMatchItemTeam(SpMatchItemTeamDTO dto);

    /**
     * 检测选手在本赛季是否报名别的组
     */
    String checkOtherGroup(Long userId, Long groupId, Long matchId);

    /**
     * 检测报名次数
     */
    String checkMatchNumw(Long userId, Long matchId, Long matchItemId);

    /**
     * 个人赛
     */
    Result saveMatchItemPerson(SpMatchItemTeamDTO dto);

    /**
     * 个人赛
     */
    Result cancel(SpMatchItemTeamDTO dto);

    /**
     * 审批后生成比赛证件
     */
    String generateTicketNo(Long matchTeamId);

    Result draw(Long id);

    Result endDraw(Long id, Long groupId);
    Result reDraw(Long id, Long groupId);

    Result rise(Long[] ids, Integer status);

    Result confirmRise(Long id, String riseFile, String promissFile, String users, String groupName, String teamId);
    Result passRise(String id, String remark);
    Result cancleRise(Long id);

    Result confirmRise2(Long id, String riseFile, String promissFile, String users, String groupName);

    Result updTeamBaseInfo(Long id, String users, String groupName, String teachers);

    Result reUploadRiseFile(Long id, String riseFile,String promissFile,String users,String groupName,String teachers);

    PageData<Map> signRecord(Map<String, Object> params);
    PageData<Map> signRecordRise(Map<String, Object> params);

    Result pass(Long[] ids, Integer status,String rejectReason);

    PageData<Map> groupCount(Map<String, Object> params);


    /**
     * 根据id查询附件并下载
     *
     * @param response
     * @throws Exception
     */
    Result<String> downloadFile(Map<String, Object> params, HttpServletResponse response) throws Exception;

    PageData<Map> queryCertificate(Map<String, Object> params);

    List<Map<String, Object>> queryStudentCerBy(Map<String, Object> params);

    List<Map<String,Object>> queryTeacherCerBy(Map<String, Object> params);

    Result<String> downloadCertificate(Map<String, Object> params, HttpServletResponse response) throws Exception;

    PageData<Map> matchScoreRecord(Map<String, Object> params);

    void certificate(Map<String, Object> params);

    void certificateTeacher(Map<String, Object> params);

    void delCertificate(String id);

    void cancelCertificateNo(String id);

    void cancelCertificateNoTeacher(String id);

    Map<String, Object> createCertificateNo(Map<String, Object> params);

    List<Map<String,Object>> createCertificateNoTeacher(Map<String, Object> params);

    void delMatchItemTeam(Long[] ids);

    void updateStatus(Long id, Integer status);

    PageData<Map> signRecordTeam(Map<String, Object> params);

    PageData<Map> signRecordStudent(Map<String, Object> params);

    //void ranksSort(Map<String, Object> params);

    PageData<Map> signRecordTeacher(Map<String, Object> params);

    PageData<Map> exportTeacher(Map<String, Object> params);

    PageData<Map> queryNoTicketUser(Map<String, Object> params);

    void genAndSaveTicketUrl(SpTicketEntity spTicketEntity, String type, String picType);

    Map<String,Object> queryScoreResult(Long matchItemTeamId);

    PageData<Map> exportCerLog(Map<String, Object> params);

    boolean updateTeacher(SpMatchItemTeamDTO dto);

    void cancleScore(Long id);

    void cancleRanks(Long id);

    void cancleUserScore(Long id);

    List<Map<String,Object>> queryTeacherByMatchItemTeamId(Long matchItemTeamId);

    String queryTeacherGroup(Long userId, Long matchItemId);

    List<SpMatchItemTeamEntity> queryRise(Long teamId);

    void ranksSortSingle(Map<String, Object> params);

    void ranksSortSingleProgram(Map<String, Object> params);

    void ranksSortTeam(Map<String, Object> params);
    void ranksSortTeamFqwd(Map<String, Object> params);

    List<Map<String,Object>> queryAllItemGroup(Long matchId);

    PageData<Map> signRecordAll(Map<String, Object> params);

    void clearAllRemark(Long id);
}
